<template>
  <div class="container">
    <div
      v-for="(item,index) in noticearticlelist"
      :key="index"
      class="invitation"
      @click="gotoContent(item.id)"
    >
      <div class="title">{{ item.title }}</div>
      <div class="time">发布日期:{{ item.time }}</div>
      <div class="author">作者:{{ item.author }}</div>
      <div class="text">{{ item.content }}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      noticearticlelist: []
    }
  },
  mounted() {
    this.noticearticlelist = JSON.parse(this.$route.query.noticeartcleinfo)
    console.log(this.noticearticlelist)
  },
  methods: {
    async gotoContent(id) {
      const res = await this.$api.artcleList.getArtcledetails(id)
      const { data:{ data:artcledetailsinfo } } = res
      this.artcledetailsinfo = {
        ...artcledetailsinfo
      }
      this.$router.push({ path:'/content/', query:artcledetailsinfo })
      // console.log(this.artcledetailsinfo,'----artcledetailsinfo')
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 20px 300px 0 300px;
  display: flex;
  flex-direction: column;
  background-color: #f8f8f8;
  .invitation {
    position: relative;
    width: 1000px;
    height: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    background-color: #ffff;
    box-shadow: 10px 10px 5px #888888;
    margin-bottom: 20px;
    .title {
      margin-top: 10px;
      margin-left: 10px;
      font-size: 20px;
      color: #fb7299;
      font-weight: 600;
      margin-bottom: 5px;
    }
    .time {
      position: absolute;
      top: 10px;
      right: 10px;
      color: #99a2aa;
      font-size: 14px;
    }
    .author {
      margin-left: 10px;
      font-size: 12px;
      color: #000;
      margin-bottom: 15px;
    }
    .text {
      margin-left: 10px;
      margin-right: 10px;
      font-size: 16px;
      color: #000;
    }
  }
}

</style>
